function failnum = testall()
    failnum = 0;
    sz = 8;
    bin0 = zeros(1,sz);
    bin1 = ones(1,sz)*255;
    ivector = [-32 -31 -30 -29 -28 -27 -26 -25 ;
        -24 -23 -22 -21 -20 -19 -18 -17 ;
        -16 -15 -14 -13 -12 -11 -10 -9 ;
        -8 -7 -6 -5 -4 -3 -2 -1 ;
        0 1 2 3 4 5 6 7 ;
        8 9 10 11 12 13 14 15 ;
        16 17 18 19 20 21 22 23 ;
        24 25 26 27 28 29 30 31];
    
    disp('test jstege_simple');
    val_j_0 = [-32   -32   -30   -30   -28   -28   -26   -26 ;
        -24   -24   -22   -22   -20   -20   -18   -18 ;
        -16   -16   -14   -14   -12   -12   -10   -10 ;
        -8    -8    -6    -6    -4    -4    -2    -2 ;
        0     1     2     2     4     4     6     6 ;
        8     8    10    10    12    12    14    14 ;
        16    16    18    18    20    20    22    22 ;
        24    24    26    26    28    28    30    30];
    ret_j_0 = jstege_simple(ivector, bin0);
    if ~isequal(val_j_0, ret_j_0)
        [val_j_0;ret_j_0]
        failnum = failnum + 1;
    end
    val_j_1 = [-31   -31   -29   -29   -27   -27   -25   -25 ;
        -23   -23   -21   -21   -19   -19   -17   -17 ;
        -15   -15   -13   -13   -11   -11    -9    -9 ;
        -7    -7    -5    -5    -3    -3    -1    -1 ;
        0     1     3     3     5     5     7     7 ;
        9     9    11    11    13    13    15    15 ;
        17    17    19    19    21    21    23    23 ;
        25    25    27    27    29    29    31    31];
    ret_j_1 = jstege_simple(ivector, bin1);
    if ~isequal(val_j_1, ret_j_1)
        [val_j_1;ret_j_1]
        failnum = failnum + 1;
    end
    
    disp('test f3e_simple');
    val_3_0 = [-32   -30   -30   -28   -28   -26   -26   -24 ;
        -24   -22   -22   -20   -20   -18   -18   -16 ;
        -16   -14   -14   -12   -12   -10   -10    -8 ;
        -8    -6    -6    -4    -4    -2    -2     0 ;
        0     0     2     2     4     4     6     6 ;
        8     8    10    10    12    12    14    14 ;
        16    16    18    18    20    20    22    22 ;
        24    24    26    26    28    28    30    30];
    ret_3_0 = f3e_simple(ivector, bin0);
    if ~isequal(val_3_0, ret_3_0)
        [val_3_0;ret_3_0]
        failnum = failnum + 1;
    end
    val_3_1 = [-31   -31   -29   -29   -27   -27   -25   -25;
        -23   -23   -21   -21   -19   -19   -17   -17;
        -15   -15   -13   -13   -11   -11    -9    -9;
        -7    -7    -5    -5    -3    -3    -1    -1;
        0     1     1     3     3     5     5     7;
        7     9     9    11    11    13    13    15;
        15    17    17    19    19    21    21    23;
        23    25    25    27    27    29    29    31];
    ret_3_1 = f3e_simple(ivector, bin1);
    if ~isequal(val_3_1, ret_3_1)
        [val_3_1;ret_3_1]
        failnum = failnum + 1;
    end

    disp('test f4e_simple');
    val_4_0 = [-31   -31   -29   -29   -27   -27   -25   -25;
        -23   -23   -21   -21   -19   -19   -17   -17;
        -15   -15   -13   -13   -11   -11    -9    -9;
        -7    -7    -5    -5    -3    -3    -1    -1;
        0     0     2     2     4     4     6     6;
        8     8    10    10    12    12    14    14;
        16    16    18    18    20    20    22    22;
        24    24    26    26    28    28    30    30];
    ret_4_0 = f4e_simple(ivector, bin0);
    if ~isequal(val_4_0, ret_4_0)
        [val_4_0;ret_4_0]
        failnum = failnum + 1;
    end
    val_4_1 = [-32   -30   -30   -28   -28   -26   -26   -24;
        -24   -22   -22   -20   -20   -18   -18   -16;
        -16   -14   -14   -12   -12   -10   -10    -8;
        -8    -6    -6    -4    -4    -2    -2     0;
        0     1     1     3     3     5     5     7;
        7     9     9    11    11    13    13    15;
        15    17    17    19    19    21    21    23;
        23    25    25    27    27    29    29    31];
    ret_4_1 = f4e_simple(ivector, bin1);
    if ~isequal(val_4_1, ret_4_1)
        [val_4_1;ret_4_1]
        failnum = failnum + 1;
    end
    
    disp('test f5e_simple');
    val_5_0 = [-32   -31   -29   -29   -28   -26   -26   -25;
        -23   -23   -22   -20   -20   -19   -17   -17;
        -16   -14   -14   -13   -11   -11   -10    -8;
        -8    -7    -5    -5    -4    -2    -2    -1;
        0     0     2     2     4     4     6     7;
        7     9    10    10    12    13    13    15;
        16    16    18    19    19    21    22    22;
        24    25    25    27    28    28    30    31];
    ret_5_0 = f5e_simple(ivector, bin0, 2);
    if ~isequal(val_5_0, ret_5_0)
        [val_5_0;ret_5_0]
        failnum = failnum + 1;
    end
    val_5_1 = [-32   -30   -30   -29   -27   -27   -26   -24;
        -24   -23   -21   -21   -20   -18   -18   -17;
        -15   -15   -14   -12   -12   -11    -9    -9;
        -8    -6    -6    -5    -3    -3    -2     0;
        0     0     1     3     4     4     6     7;
        7     9    10    10    12    13    13    15;
        16    16    18    19    19    21    22    22;
        24    25    25    27    28    28    30    31];
    ret_5_1 = f5e_simple(ivector, bin1, 2);
    if ~isequal(val_5_1, ret_5_1)
        [val_5_1;ret_5_1]
        failnum = failnum + 1;
    end
end
